package jw.repository.order;


import jw.model.order.WxOrder;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface WxOrderRepository extends JpaRepository<WxOrder,Integer>, JpaSpecificationExecutor<WxOrder> {

    @Query("select o from WxOrder o where o.agentId =?1 and o.status not in(8,9,10,98,99,101)")
    List<WxOrder>findByAgentIdByPage(Integer agentId,Pageable pageable);

    @Query("select count(o.id) from WxOrder o where o.agentId =?1 and o.status not in(8,9,10,98,99,101)")
    Integer findTotalPageByAgentId(Integer agentId);

    List<WxOrder>findByAgentIdAndStatus(Integer agentId,Integer type,Pageable pageable);

    @Query("select count(o.id) from WxOrder o where o.agentId =?1 and o.status =?2")
    Integer findTotalPageByStatus(Integer agentId,Integer type);

}
